<template>
<div class="week">
    <div class="week-a"
    v-for="(item, index) in titles" :key="item.id"
    :class="{active: currentIndex === index}"
    @click="itemClick(index)">
      <div class="week-a-a">
        <div class="day">{{item.day}}</div>
        <div class="data">{{item.date}}</div>
      </div>
    </div>
  </div>
</template>

<script>
  export default {
    name: 'Week',
    data() {
      return {
        currentIndex: 0,
        titles: [
          {
            id: '001',
            day: '今天',
            date: '十月十号'
          },
          {
            id: '002',
            day: '明天',
            date: '十月十号'
          },
          {
            id: '003',
            day: '后天',
            date: '十月十号'
          },
          {
            id: '004',
            day: '星期一',
            date: '十月十号'
          },
          {
            id: '005',
            day: '星期二',
            date: '十月十号'
          },
          {
            id: '006',
            day: '星期三',
            date: '十月十号'
          },
          {
            id: '007',
            day: '星期四',
            date: '十月十号'
          },
        ]
      }
    },
    methods: {
      itemClick(index) {
        this.currentIndex = index
        this.$emit('tabClick', index)
      }
    }

  }
</script>

<style scoped>
.week {
  padding: 0 10px 5px;
  display: flex;
  flex-direction: row;
  overflow-x: auto;
  /* background-color: thistle; */
}

.week-a-a {
  padding: 5px 10px;
  width: 60px;
}

.week-a {
  margin: 5px;
  text-align: center;
  display: flex;
  border-radius: 15px;
  background-color: rgb(255, 255, 255);
}

.day {
  font-size: 16px;
}

.data {
  font-size: 10px;
}

.active {
		color: rgb(255, 255, 255);
    background-color: #666;
    border-radius: 15px;
	}

  ::-webkit-scrollbar{
   display:none;
  }


</style>